/*
    1.定义枚举类，枚举出日志等级
    2.提供转换接口：将枚举转换为对应字符串
*/
#ifndef __M_LEVEL_H__//防止头文件的重复包含
#define __M_LEVEL_H__

namespace yuanlog
{
    class LogLevel
    {
        public:
            enum class value {
                UNKNOW = 0,
                DEBUG,
                INFO,//提示等级
                WARN,//警告等级
                ERROR,//错误等级
                FATAL,//致命等级
                OFF
            };
            static const char *toString(LogLevel::value level) //枚举的转换接口
            {
                switch(level) {
                    // #define TOSTRING(name) #name
                    case LogLevel::value::DEBUG: return "DEBUG";
                    case LogLevel::value::INFO: return "INFO";
                    case LogLevel::value::WARN: return "WARN";
                    case LogLevel::value::ERROR: return "ERROR";
                    case LogLevel::value::FATAL: return "FATAL";
                    case LogLevel::value::OFF: return "OFF";
                    // #undef TOSTRING
                    // default: return "UNKNOW";
                }
                return "UNKNOW";
            }
    };
}
#endif